import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

public class demo7 {
    public static void main(String[] args) throws IOException {
     /*   Reader reader=new FileReader("d:/test.txt");*/
        /*while(true){
            int c=reader.read();
            if(c==-1){
                break;
            }
            char ch=(char)c;
            System.out.println(ch);
        }*/
       /* try{
            while(true){
                char[] cbuf=new char[3];
                int n=reader.read(cbuf);
                if(n==-1){
                    break;
                }
                System.out.println("n="+n);
                for(int i=0;i<n;i++){
                    System.out.println(cbuf[i]);
                }
            }
        }finally {
            reader.close();
        }*/
        try (Reader reader = new FileReader("d:/test.txt")) {
            while (true) {
                char[] cbuf = new char[3];
                int n = reader.read(cbuf);
                if (n == -1) {
                    break;
                }
                System.out.println("n = " + n);
                for (int i = 0; i < n; i++) {
                    System.out.println(cbuf[i]);
                }
            }
        }
    }
}
